package com.example.task1.ui.AllService.subway;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.example.task1.bean.LifeTabBean;
import com.example.task1.ui.AllService.life.LifeNewsFragment;

import java.util.List;

public class SubwayTabAdapter extends FragmentPagerAdapter {

    private List<LifeTabBean.DataDTO> data;

    public SubwayTabAdapter(@NonNull FragmentManager fm, List<LifeTabBean.DataDTO> data) {
        super(fm);
        this.data = data;
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        return new SubwayBaseNewsFragment().newInstance(data.get(position).getId() + "", "");
    }

    @Override
    public int getCount() {
        return data.size();
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return data.get(position).getName();
    }
}
